import os
import sys
from enum import Enum
from selenium import webdriver


path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'lib')
sys.path.append(path)


class BrowserType(Enum):
    """浏览器与驱动的对应关系"""
    chrome = 'chromedriver.exe'


class Browser(object):
    @staticmethod
    def open_driver(type):
        if type == 'chrome':
            driver = webdriver.Chrome(executable_path=os.path.join(path, BrowserType.chrome.value))
        else:
            pass
        return driver


